﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Linq;
using Administracija.Repository;
using Administracija.DataLayer;

namespace Administracija
{
    public partial class JezikRecView : Common.Forms.RecView
    {
        RJezik rJezik = new RJezik();
        int id;

        public JezikRecView(int id)
        {
            InitializeComponent();
            this.id = id;
        }

        private void JezikRecView_Load(object sender, EventArgs e)
        {
            if (id == 0)
                bindingSource1.DataSource = rJezik.Nov();
            else
                bindingSource1.DataSource = rJezik.Izmeni(this.id);
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                Index = rJezik.Snimi((Jezik)bindingSource1.Current);
            }
            catch (Exception ex)
            {
                Common.Tools.MessageError.Show(ex.Message);
                this.DialogResult = DialogResult.None;
            }
        }
    }
}
